package Top200;

import common.ListNode;

/**
 * @author zhangmin
 * @create 2022-02-19 10:07
 * 递归
 */
public class swapPairs24 {
    public ListNode swapPairs(ListNode head) {
        if (head==null||head.next==null) return head;
        ListNode first=head,second=head.next;
        ListNode sec = swapPairs(head.next.next);
        second.next=first;
        first.next=sec;
        return second;
    }
}
